package wlf.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import wlf.mapper.ShopMapper;
import wlf.pojo.Shop;
import wlf.pojo.Table;
import wlf.service.ShopService;

@Service
public class ShopServiceImpl implements ShopService {
	@Resource
	private ShopMapper shopMapper;
	
	@Override
	public List<Shop> allShop() {
		return shopMapper.selAll();
	}
	public Table<Shop> page(int page, int limit, Shop shop) {
		Table<Shop> table = new Table<>();
		table.setData(shopMapper.page((page-1)*limit, limit, shop));
		table.setCount(shopMapper.pageCount(shop));
		table.setMsg("success");
		table.setCode(0);
		return table;
	}

	@Override
	public int addShop(Shop shop) {
		return shopMapper.insShop(shop);
	}
	@Override
	public int updShop(Shop shop) {
		return shopMapper.updShop(shop);
	}
	@Override
	public int delShop(int id) {
		return shopMapper.delShop(id);
	}

	@Override
	public int updShopStatus(int id, int status) {
		return shopMapper.updShopStatus(id,status);
	}

}
